package com.fxz.rabbitmq.api.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * 消息类型枚举
 *
 * @author Fxz
 * @version 1.0
 * @date 2021-08-17 12:28
 */
@AllArgsConstructor
@Getter
public enum MessageTypeEnum {

    RAPID("0", "迅速消息:不需要保障消息的可靠性,也不需要做confirm确认"),
    CONFIRM("1", "确认消息:不需要保证消息的可靠性,但是会做消息的confirm确认"),
    RELIANT("2", "可靠谱性消息,一定保证消息的100%可靠性投递,不允许有任何消息的丢失");

    private final String code;
    private final String desc;

    public static String getStringByCode(String type) {
        if(RAPID.getCode().equals(type)){
            return "RAPID";
        }else if(CONFIRM.getCode().equals(type)){
            return "CONFIRM";
        }else{
            return "RELIANT";
        }
    }

}
